package com.wanglemei.mail.util;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class EmailServer implements Serializable
{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1889795832743499156L;
	private String host;
	private String port;
	private  static Map<String, EmailServer>  eServerMap=null;
	
    static
    {
    	         eServerMap=new HashMap<String, EmailServer>();
    	         eServerMap.put("sina.com", new EmailServer("smtp.sina.com", "25"));
    	         eServerMap.put("qq.com", new EmailServer("smtp.qq.com", "25"));
    	         eServerMap.put("126.com", new EmailServer("smtp.126.com", "25"));
    	         eServerMap.put("163.com", new EmailServer("smtp.163.com", "25"));
    	         eServerMap.put("yeah.net", new EmailServer("smtp.yeah.net", "25"));
    	         eServerMap.put("mail.yahoo.com", new EmailServer("smtp.mail.yahoo.com", "465"));
    	         eServerMap.put("gmail.com", new EmailServer("smtp.gmail.com", "465"));
    	         eServerMap.put("live.com", new EmailServer("smtp.live.com", "25"));
    }

	private  EmailServer()
	{
	}
	
	private EmailServer(String host, String port)
	{
		this.host = host;
		this.port = port;
	}
    
    public static EmailServer getEmailServerByAddress(String eAddress)
    {
    	      if (null!=eAddress&&!"".equals(eAddress))
			{
				  return eServerMap.get(eAddress);
			}
    	      return null;
    }

	public String getHost()
	{
		return host;
	}

	public void setHost(String host)
	{
		this.host = host;
	}

	public String getPort()
	{
		return port;
	}

	public void setPort(String port)
	{
		this.port = port;
	}

}
